<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>系统管理</el-breadcrumb-item>
      <el-breadcrumb-item>参数设置</el-breadcrumb-item>
    </el-breadcrumb>

    <el-card>

<el-row :gutter="20">    

<el-col :span="4">
                <el-label>变量因素</el-label>
            </el-col>

<el-col :span="2">
                <el-label>分值</el-label>
            </el-col>

</el-row> 

<el-row :gutter="20">
            <el-col :span="4">
                <el-label>性别</el-label>
            </el-col>
        <el-col :span="2">
             <el-label>{{b1}}</el-label>
        </el-col>
</el-row> 

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>司机年龄</el-label>
            </el-col>
        <el-col :span="2">
            <el-label>{{b2}}</el-label>
        </el-col>
</el-row> 

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>开车不玩手机</el-label>
            </el-col>
        <el-col :span="2">
            <el-label>{{b3}}</el-label>
        </el-col>

</el-row> 


<el-row :gutter="20">
        <el-col :span="4">
                <el-label>最大的车速</el-label>
            </el-col>
        <el-col :span="2">
             <el-label>{{b4}}</el-label>
        </el-col>
</el-row>

<el-row :gutter="20">
            <el-col :span="4">
                <el-label>是否急转弯</el-label>
            </el-col>
        <el-col :span="2">
             <el-label>{{b5}}</el-label>
        </el-col>
</el-row>

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>是否急加速</el-label>
            </el-col>
        <el-col :span="2">
            <el-label>{{b6}}</el-label>
        </el-col>

</el-row> 


<el-row :gutter="20">
        <el-col :span="4">
                <el-label>是否急减速</el-label>
            </el-col>
        <el-col :span="2">
            <el-label>{{b7}}</el-label>
        </el-col>
</el-row>

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>路面平整度</el-label>
            </el-col>
        <el-col :span="2">
            <el-label>{{b8}}</el-label>
        </el-col>
</el-row>

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>早高峰时间占比</el-label>
            </el-col>
        <el-col :span="2">
            <el-label>{{b9}}</el-label>
        </el-col>
</el-row>

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>晚高峰时间占比</el-label>
            </el-col>
        <el-col :span="2">
             <el-label>{{b10}}</el-label>
        </el-col>
</el-row>

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>夜间出行时间占比</el-label>
            </el-col>
        <el-col :span="2">
            <el-label>{{b11}}</el-label>
        </el-col>
</el-row>

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>平均时速</el-label>
            </el-col>
        <el-col :span="2">
            <el-label>{{b12}}</el-label>
        </el-col>

</el-row> 

<el-row :gutter="20">
            <el-col :span="4">
                <el-label>平均加速度</el-label>
            </el-col>
        <el-col :span="2">
             <el-label>{{b13}}</el-label>
        </el-col>
</el-row>

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>平均角加速度</el-label>
            </el-col>
        <el-col :span="2">
             <el-label>{{b14}}</el-label>
        </el-col>
</el-row>

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>总里程</el-label>
            </el-col>
        <el-col :span="2">
            <el-label>{{b15}}</el-label>
        </el-col>
</el-row> 



<el-row :gutter="20">
        <el-col :span="4">
                <el-label>驾驶平顺度</el-label>
            </el-col>
        <el-col :span="2">
             <el-label>{{b16}}</el-label>
        </el-col>
</el-row>

<el-row :gutter="20">
        <el-col :span="4">
                <el-label>常数</el-label>
            </el-col>
        <el-col :span="2">
             <el-label>{{b0}}</el-label>
        </el-col>

      </el-row> 

    </el-card>

  </div>
</template>

<script>

export default {
  data () {
    return {

      nowcontact: {},

      paramList: [],

      b1:0,b2:0,b3:0,b4:0,
      b5:0,b6:0,b7:0,b8:0,
      b9:0,b10:0,b11:0,b12:0,
      b13:0,b14:0,b15:0,b16:0,
      b0:0,


    }
  },
  created () {
    // 加载页面时 加载一次数据
    this.getparamList()
  },
  methods: {
  
  async getparamList () {
      const { data: res } = await this.$http.get('param/getparam/B')
      if (res.code !== 200) return this.$message.error('Error:' + res.message)
      this.paramList = res.data
     // console.log(res.data)
      
      this.b1 = this.paramList[0].value
      this.b2 = this.paramList[1].value
      this.b3 = this.paramList[2].value
      this.b4 = this.paramList[3].value
      this.b5 = this.paramList[4].value
      this.b6 = this.paramList[5].value
      this.b7 = this.paramList[6].value
      this.b8 = this.paramList[7].value
      this.b9 = this.paramList[8].value
      this.b10 = this.paramList[9].value
      this.b11 = this.paramList[10].value
      this.b12 = this.paramList[11].value
      this.b13 = this.paramList[12].value
      this.b14 = this.paramList[13].value
      this.b15 = this.paramList[14].value
      this.b16 = this.paramList[15].value
      this.b0 = this.paramList[16].value
    },

    async updateparam () {
      const { data: res } = await this.$http.post(
        'param/updateparam',
        { 
        'B0': this.b0, 
        'B1': this.b1, 
        'B2': this.b2, 
        'B3': this.b3, 
        'B4': this.b4, 
        'B5': this.b5, 
        'B6': this.b6, 
        'B7': this.b7, 
        'B8': this.b8, 
        'B9': this.b9, 
        'B10': this.b10, 
        'B11': this.b11, 
        'B12': this.b12, 
        'B13': this.b13, 
        'B14': this.b14, 
        'B15': this.b15, 
        'B16': this.b16, 

        }, {
          headers: {
            'content-type': 'application/json',
            'X-Request-With': 'XMLHttpRequest',
            'token': window.sessionStorage.getItem('token')
          }
        }
      )
      if (res.code !== 200) return this.$message.error('Error:' + res.message)
      this.getparamList()
    },



  },
  filters: {

  }
}
</script>

<style lang="less" scope>
.el-row {
    &:last-child {
      margin-bottom: 0px;
      align:'center'
    }
  }

.el-col{
    border: 1px solid black
}

.el-label{
  align:'center'
}
</style>
